<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>

<jsp:directive.include file="/controleDeAcesso/autenticado.jsp" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Meus classificados</title>
</head>
<h2>Seus anúncios:</h2>
<body>
<f:view>
		<h:dataTable border="1" id="lista" value="#{anuncioMBean.anunciosDoUsuario}" var="an">
			<h:column id="column1">
				<f:facet name="header"> <h:outputText value="Descrição" /></f:facet>
				<h:outputText value="#{an.descricao}" />
			</h:column>
			<h:column id="column2">
				<f:facet name="header"><h:outputText value="Valor" /></f:facet>
				 <h:outputText value="#{an.valor}" /> 
			</h:column>
		</h:dataTable>


<p>Cadastrar novo anúncio:</p>
<br>
		<h:form>
			<h:panelGrid border="1" columns="2">
				<h:outputText value="Descrição: "></h:outputText>
				<h:inputText value="#{anuncioMBean.novoAnuncio.descricao}" required="true" style="width: 401px; "></h:inputText>
				<h:outputText value="Valor: "></h:outputText>
				<h:inputText value="#{anuncioMBean.novoAnuncio.valor}" required="true"></h:inputText>
				<h:outputText value="Detalhes: "></h:outputText>
				<h:inputTextarea value="#{anuncioMBean.novoAnuncio.detalhes}" required="true" style="width: 486px; height: 117px; "></h:inputTextarea>
			</h:panelGrid>
			<h:commandButton value="Criar Anúncio" action="#{anuncioMBean.cadastrarAnuncio}"></h:commandButton>
		</h:form>
		
		
		
	</f:view>
</body>
</html>